﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Windows.Forms;
using TestWinApp.Models;

namespace TestWinApp
{
    public partial class Form1 : Form
    {
        bool error = false;
        public Form1()
        {
            InitializeComponent();
            EntityExtensionsAction.Executing = () => { error = false; };
            EntityExtensionsAction.DbError = (ex) =>
            {
                error = true;
                MessageBox.Show("Bu global action\n" + ex.ToString());
            };
        }


        private void button1_Click(object sender, EventArgs e)
        {
            using (var Db = new DBEntities())
            {   
                Db.ExecuteSP(() => { Db.spTest("oğuz"); });
                if (!error)
                {
                    MessageBox.Show("eklendi");
                }
            }
        }
    }
}
